<%@ page language="java" isELIgnored="false" import="java.util.*" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>起飞时间差距设置——恒拓运价魔方</title>
<link href="<%=request.getContextPath()%>/fare/css/base.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=request.getContextPath()%>/fare/js/show.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/fare/js/jquery-1.6.4.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/fare/js/datePicker/WdatePicker.js"></script>
<script type='text/javascript' src='<%=request.getContextPath()%>/fare/js/cityquery/citylist.js'></script>
<script type='text/javascript' src='<%=request.getContextPath()%>/fare/js/cityquery/querycity.js'></script>
<script src="<%=request.getContextPath()%>/fare/lib/ligerUI/js/core/base.js" type="text/javascript"></script>
<script src="<%=request.getContextPath()%>/fare/lib/ligerUI/js/plugins/ligerGrid.js" type="text/javascript"></script>
 <link href="<%=request.getContextPath()%>/fare/lib/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
<link href='<%=request.getContextPath()%>/fare/js/cityquery/cityquery.css' rel="stylesheet" type="text/css" />
<!-- 圆角文本框 -->
<link href="<%=request.getContextPath() %>/fare/css/htc/htc.css" rel="stylesheet" type="text/css" />

<script>

//扩展currency类型的对比函数 
$.ligerDefaults.Grid.sorters['currency'] = function (val1, val2)
{
    return parseFloat(val1) < parseFloat(val2) ? -1 : parseFloat(val1) > parseFloat(val2) ? 1 : 0;
};

$(function ()
{
    $("#maingrid").ligerGrid({
        columns: [
            { display: '航段', name: 'fromcity', align: 'center', width: 330 },
            { display: '起飞时间差距(小时)', name: 'timeGap', align: 'right' ,type:'currency' },
            { display: '操作人', isSort: false, name: 'userid', align: 'center', type: 'float',width:180 },
            { display: '操作时间', isSort: true ,name: 'userCreatetime', align: 'center', type: 'float',width:200},
            { display: '操作', isSort: false, width: 100, name:'alink'}],   
            data: ${takeoffJson}  //数据
    });

});
</script>
<script type="text/javascript">
	$(document).ready(function(){
		$('#fromCity').querycity({'data':citysFlight,'tabs':labelFromcity,'hotList':hotList});
		$('#toCity').querycity({'data':citysFlight,'tabs':labelFromcity,'hotList':hotList});
	});
	$(document).ready(function(){
		$('#fromCity2').querycity({'data':citysFlight,'tabs':labelFromcity,'hotList':hotList});
		$('#toCity2').querycity({'data':citysFlight,'tabs':labelFromcity,'hotList':hotList});
	});
	
	//保存抓取航空设置提交
	function checkForm() {
		if ($("#timeGap").val() == '') {
			alert("起飞时间差距不能为空！");
			$("#timeGap").focus();
			return false;
		}
		 var timeGap = $("#timeGap").val();
		
		if ($("#fromCity").val() == '' || $("#fromCity").val() == '中文/拼音') {
			alert("航段不能为空！");
			$("#fromCity").focus();
			return false;
		}
		if ($("#toCity").val() == '' || $("#toCity").val() == '中文/拼音') {
			alert("航段不能为空！");
			$("#toCity").focus();
			return false;
		}
		if($("#fromCity").val() ==$("#toCity").val() ){
			alert("航段起始设置不能相同！");
			$("#fromCity").focus();
			return false;
		}
		 if(isNumber(timeGap)){
			if (parseFloat(timeGap) <0 || parseFloat(timeGap)>100 ) {
				alert("起飞时间差范围从0到100！");
				$("#timeGap").focus();
				return false;
			}
			if(timeGap==0.5){
				alert("0.5是所有航段默认值，不需要设置");
				return false;
			}
			
		$("#taskForm").submit();
		} 
	}
	

	//数值检测 
	function isNumber(txt){  
		
		//被校验的值
		var pattern=/^\d\.\d{1}$/;   
		var pattern2=/^\d$/; 
		if(isNaN(txt))
		{    
			alert("请输入数字!");
			return false;
		}else{
			return true;
		}
	} 

	function showTaskoffTimeList() {
		
		$("#showTaskoffTimeListForm").submit();
	}

	//分页查询
	function searchOnSubmit() {
		var pageSize = $("#pageSize").val();
		var pageNum = $("#pageNum").val();
		if (pageSize != "" || pageNum != "") {
			$("#taskForm").attr("action","taskInfoAction!showTakeoffTimeList.action?pageSize="+ pageSize + "&pageNum=" + pageNum).submit();
		} else {
			$("#taskForm").submit();
		}
	}
 
 /***************************
  *           删除记录
  ***************************/
  function del(str){
     if(confirm('确定要删除吗？')){
    	 $("#delTaskoffTimeListForm").attr("action","taskInfoAction!deleteTakeoffTimeEntity.action?id="+str).submit();
     }
 }
	
	
</script>

<style type="text/css">
<!--
.STYLE1 {
	color: #3366cc
}
-->
</style>
</head>

<body >

	<form id="taskForm" action="taskInfoAction!editTakeoffTime.action" method="post">
		<TABLE cellSpacing=1 cellPadding=3 width="100%" border=0 class="tabg">
			<TBODY>
				<TR class="tabtr1">
					<TD colspan="4" style="color: white">起飞时间差距设置 </TD>
				</TR>
				<TR class="tab">
					<TD width="10%" style="text-align: left" height="26" class="td1">配置描述：</TD>
					<TD colspan="3"><textarea style="width: 500px; resize: none;" rows="3" cols="50"></textarea></TD>
				</TR>
				<input type="hidden" id="id" name="id" value="${voEntity.id }"/>
				<TR class="tab">
					<TD height="26" style="text-align: left; color: white" class="tabgtd1">起飞时间差距：</TD>
					<TD class="tabgtd2">
						<input type="text" style="width: 70px" id="timeGap" value="${voEntity.timeGap }" name="timeGap"
						> <span>小时</span> 
						<span style="color: #FF0000">*(范围从0-100)</span>
					</TD>
					<TD height="26" style="text-align: left" class="tabgtd1">航&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;段：</TD>
					<TD class="tabgtd2">
						<span>从</span> 
						<input type="text" style="width: 100px" id="fromCity" value="${voEntity.fromcity }" name="fromCity" readonly="readonly"> 
						<span>到</span> 
						<input type="text" style="width: 100px" id="toCity" value="${voEntity.tocity }" name="toCity" readonly="readonly"> 
						<span style="color: #FF0000">*</span>
					</TD>
				</TR>
	
				<TR class="tab">
					<TD height="26" colspan="8" align="center" class="tabgtd3">
					<input type="button" name="Submit222" value="保存" id="Submit222" style="width: 80px;cursor: pointer; cursor: hand;" 
						onclick="javascript:checkForm();"></TD>
				</TR>
			</TBODY>
		</TABLE>
	</form>

	<p></p>
	<form id="showTaskoffTimeListForm" action="taskInfoAction!deleteTakeoffTimeEntity.action?" method="post">
		<TABLE cellSpacing=1 cellPadding=3 width="100%" border=0 class="tabg">
			<TBODY>
				<TR class="tabtr1">
					<TD colspan="4" style="color: white">起飞时间差查询</TD>
				</TR>
	
				<TR class="tab">
				<TD height="26" style="text-align: left" class="tabgtd1" width="10%">起飞时间差距：</TD>
					<TD class="tabgtd2">
						<input type="text" style="width: 70px" id="timeGap1" value="" name="timeGap">
						<span>小时</span> <span style="color: #FF0000">*(范围从0-100)</span>
					</TD>
					<TD width="10%" style="text-align: left" height="26" class="tabgtd1">航&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;段：</TD>
					<input type="hidden" id = "queryflag" value="0" name="queryflag" />
					<TD class="tabgtd2">
						<span>从 </span> 
						<input type="text" style="width: 100px" id="fromCity2" value="" name="fromCity" readonly="readonly"> 
						<span>到</span> 
						<input type="text" style="width: 100px" id="toCity2" value="" name="toCity" readonly="readonly">
					</TD>
				</TR>
	
				<TR class="tab">
					<TD height="26" colspan="4" align="center" class="tabgtd3">
					<input type="button" name="Submit222" value="查询" id="Submit222" style="width: 80px;cursor: pointer; cursor: hand;" 
						onclick="javascript:showTaskoffTimeList();"></TD>
				</TR>
			</TBODY>
		</TABLE>
	    </form>
		<p></p>
		<div id="maingrid" style="margin-top:20px"></div>
		<div style="display: none;"></div>
		<form id="delTaskoffTimeListForm" action="taskInfoAction!deleteTakeoffTimeEntity.action" method="post"></form>
</body>
</html>



